﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pattern.Data;

namespace Pattern.Logic
{
    public static class Prog
    {
        public static void Test()
        {
            const string directory = @"D:\Dropbox\MAG\Dane\XML\";
            const string saveDir = @"D:\Dropbox\MAG\Dane\Results\";
            var problems = Deserialize.GetData(directory);

            var validList = problems.Select(pr => new Validation(pr.Item1, pr.Item2)).ToList();
            var parOptions = new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount * 2 };
            Parallel.ForEach(validList, parOptions, v =>

                SaveOutData.Save(v.Validate(), Path.Combine(saveDir, v.Name + ".csv")));
            //foreach (var v in validList)
            //{
            //    SaveOutData.Save(v.Validate(), Path.Combine(saveDir, v.Name + ".csv"));
            //}
        }
    }
}
